<%--
  Created by IntelliJ IDEA.
  User: Yy
  Date: 2022/5/17
  Time: 16:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <script>
        layui.use(['table','util','jquery','layer','form'],function () {
            var table = layui.table, util = layui.util, $ = layui.jquery, layer = layui.layer, form = layui.form;

            //监听表单模糊查询
            form.on('submit(search-btn)', function (d) {
                var stuname = $("#stuname").val();
                var projectName = $("#projectName").val();
                table.reload('titleStu', {//指定条件重载table
                    page: {page: 1},
                    where: { //条件
                        stuname: stuname,
                        projectName: projectName,
                    },
                });
            });
            //监听显示全部按钮
            $("#list-btn").click(function () {
                location.reload('demo');
            });
            //监听添加按钮
            $("#add-btn").click(function () {
                layer.open({
                    type:2,//设置为iframe
                    fix:false,//不固定
                    maxmin:true,//出现最大化最小化按钮
                    offset:'5px',//垂直水平位置
                    shade:0.4,//遮罩层透明度
                    area:['500px','700px'],//弹出层宽高
                    title:"新增答辩成绩",//弹出层标题
                    content:'${pageContext.request.contextPath}/stu/toaddstureplyscore'//弹出层内网页
                });
            });
            //监听工具栏按钮
            table.on('tool(demo)',function (res) {
                var row=res.data; //获取当前行的数据
                var event=res.event;//获取点的是哪个按钮
                var replyId=row.replyId;//获取行中的id列
                if (event=='del'){//删除用户
                    // alert(scoreId);
                    layer.confirm("是否删除该学生成绩？",{
                        btn:['确定','取消']
                    },function() {
                        $.post("${pageContext.request.contextPath}/stu/delstureplyscore",{replyId:replyId},function (data) {
                            layer.msg(data.msg);//使用消息层 显示删除的结果
                            table.reload('titleStu',{
                                url:"${pageContext.request.contextPath}/stu/stureplyscorelist"
                            });
                        },"json");
                    });
                };
                if(event=='edit'){
                    layer.open({
                        type:2,//设置为iframe
                        fix:false,//不固定
                        maxmin:true,//出现最大化最小化按钮
                        offset:'10px',//垂直水平位置
                        shadeClose:true,
                        shade:0.4,//遮罩层透明度
                        area:['500px','700px'],//弹出层宽高
                        title:"修改学生成绩",//弹出层标题
                        content:'${pageContext.request.contextPath}/stu/toupdstureplyscore/'+replyId//弹出层内网页
                    });
                };
            });



        });
    </script>
</head>
<body>
<%--    <h1 style="text-align: center">学生答辩信息</h1>--%>
    <div>
        <form class="layui-form">
            <div class="layui-inline">学生名:</div>
            <div class="layui-inline">
                <input type="text" name="stuname" id="stuname" class="layui-input"/>
            </div>
            <div class="layui-inline">项目名字:</div>
            <div class="layui-inline">
                <input type="text" name="projectName" id="projectName" class="layui-input"/>
            </div>
            <a class="layui-btn" lay-filter="search-btn" lay-submit="" lay-size="sm">搜索</a>
            <a class="layui-btn" id="add-btn" lay-size="sm">添加答辩成绩</a>
            <a class="layui-btn" id="list-btn" lay-size="sm">显示全部</a>
        </form>
    </div>
    <table class="layui-table" id="titleStu" lay-filter="demo" lay-size="sm"
           lay-data="{url:'${pageContext.request.contextPath}/stu/stureplyscorelist',page:true,id:'titleStu'}"
    >
        <thead>
        <tr>
            <th lay-data="{field:'replyId',sort:true}">学生编号</th>
            <th lay-data="{field:'stuname',sort:true}">学生姓名</th>
            <th lay-data="{field:'projectName',sort:true}">项目名字</th>
            <th lay-data="{field:'empName',sort:true}">打分老师</th>
            <th lay-data="{field:'score1',sort:true}">功能完善50</th>
            <th lay-data="{field:'score2',sort:true}">技术难度10</th>
            <th lay-data="{field:'score3',sort:true}">界面完美10</th>
            <th lay-data="{field:'score4',sort:true}">回答问题10</th>
            <th lay-data="{field:'score5',sort:true}">演示方法10</th>
            <th lay-data="{field:'score6',sort:true}">语言表达10</th>
            <th lay-data="{field:'score7',sort:true}">总分100</th>
            <th lay-data="{field:'remark',sort:true}">备注</th>
            <th lay-data="{toolbar:'#tools',width:150,align:'center',fixed:'right'}">操作</th>
        </tr>
        </thead>
    </table>
    <script type="text/html" id="tools">
        <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
        <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
    </script>
</body>
</html>
